package com.sl.mes.db.service.org;

import com.alibaba.druid.util.StringUtils;
import com.github.pagehelper.PageHelper;
import com.sl.mes.db.dao.BdPsndocMapper;
import com.sl.mes.db.dao.BdPsnjobMapper;
import com.sl.mes.db.itf.org.IBdPsnDoc;
import com.sl.mes.db.vo.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * 人员
 */
@Service
public class BdPsnDocService implements IBdPsnDoc {
    @Resource
    private BdPsndocMapper bdPsndocMapper;
    @Resource
    private BdPsnjobMapper bdPsnjobMapper;

    /**
     * 根据主键查询人员信息
     * @param pk_psndoc
     * @return
     */
    @Override
    public BdPsndoc findById(String pk_psndoc) {
        return bdPsndocMapper.selectByPrimaryKey(pk_psndoc);
    }



    @Override
    public List<BdPsnjob> getPsnJobByPsnId(String pk_psndoc) {
        BdPsnjobExample example=new BdPsnjobExample();
        //example.or().andIdIn(Arrays.asList(pk_psndoc)).andEnabledEqualTo(true).andDeletedEqualTo(false);
        example.or().andPkPsndocEqualTo (pk_psndoc).andDrEqualTo(0);

        List<BdPsnjob> lstPsnJob=bdPsnjobMapper.selectByExample(example);

        return lstPsnJob;
    }

    @Override
    public List<BdPsndoc> getPsnByPsnId(String pk_psndoc) {
        BdPsndocExample example=new BdPsndocExample();
        example.or().andPkPsndocEqualTo(pk_psndoc).andDrEqualTo(0);
        List<BdPsndoc> lstPsnDoc=bdPsndocMapper.selectByExample(example);
        return lstPsnDoc;
    }
}
